﻿using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;

namespace Customs.Components.SLXNK
{
	/// <summary>
	/// Cửa khẩu.
	/// </summary>
	public class CuaKhau
	{
		public static DataTable SelectAll(string maCucHaiQuan)
		{
			string connectionString = ConfigurationManager.AppSettings["SLXNKConnectionString"];
			string query = "SELECT Ma_CK, dbo.TCVN2Unicode(Ten_CK) AS Ten_CK FROM SCUAKHAU WHERE MA_Cuc LIKE @Ma_Cuc ORDER BY Ten_CK;";
			SqlParameter[] parameters = new SqlParameter[1];
			parameters[0] = new SqlParameter("@Ma_Cuc", maCucHaiQuan);
			DataTable dt = SqlHelper.ExecuteDataset(connectionString, CommandType.Text, query, parameters).Tables[0];
			DataRow row = dt.NewRow();
			row["Ma_CK"] = "   ";
			row["Ten_CK"] = "[Tất cả]";
			dt.Rows.Add(row);
			return dt;
		}		
	}
}
